package com.ntschy.common.core.entity.dataobject;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ntschy.common.core.BaseEntity;
import com.ntschy.common.core.entity.enums.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

/**
 * 菜单权限表 sys_menu
 *
 * @author ezreal_geng
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@TableName("SYS_MENU")
@ApiModel(description = "菜单实体类")
public class SysMenu extends BaseEntity {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "菜单id")
    @TableId
    private String id;

    @ApiModelProperty(value = "菜单名称")
    @TableField(value = "Name")
    private String name;

    @ApiModelProperty(value = "父菜单名称")
    @TableField(value = "ParentName")
    private String parentName;

    @ApiModelProperty(value = "父菜单ID")
    @TableField(value = "ParentID")
    private String parentId;

    @ApiModelProperty(value = "显示顺序")
    @TableField(value = "OrderNum")
    private Integer orderNum;

    @ApiModelProperty(value = "路由地址")
    @TableField(value = "Path")
    private String path;

    @ApiModelProperty(value = "激活菜单项")
    @TableField(value = "ActiveMenu")
    private String activeMenu;

    @ApiModelProperty(value = "组件路径")
    @TableField(value = "Component")
    private String component;

    @ApiModelProperty(value = "是否为外链（0否 1是）")
    @TableField(value = "IsFrame")
    private SysWhetherEnum isFrame;

    @ApiModelProperty(value = "是否缓存（0不缓存 1缓存）")
    @TableField(value = "IsCache")
    private SysMenuCache isCache;

    @ApiModelProperty(value = "类型（0目录 1菜单 2按钮）")
    @TableField(value = "MenuType")
    private SysMenuTypeEnum menuType;

    @ApiModelProperty(value = "显示状态（0显示 1隐藏）")
    @TableField(value = "visible")
    private SysMenuVisibleEnum visible;

    @ApiModelProperty(value = "权限字符串")
    @TableField(value = "Perms")
    private String perms;

    @ApiModelProperty(value = "菜单图标")
    @TableField(value = "Icon")
    private String icon;

    @ApiModelProperty(value = "菜单|按钮请求地址")
    @TableField(value = "HttpUrl")
    private String httpUrl;

    @TableField(fill = FieldFill.INSERT, value = "CreateUserId")
    @ApiModelProperty(value = "创建人ID")
    private String createUserId;

    @TableField(fill = FieldFill.INSERT, value = "CreateTime")
    @ApiModelProperty(value = "创建时间")
    private String createTime;

    @ApiModelProperty(value = "子菜单")
    @TableField(exist = false)
    private List<SysMenu> children = new ArrayList<>();

    @TableField(exist = false)
    private SysDataScopeEnum dataScope;
}
